/**
 * @Project Name:shiro-demo
 * @Package Name:cn.hoofungson.studio.shiro.demo.dao
 * @Since JDK 1.8
 */
package cn.hoofungson.studio.shiro.demo.dao;

import cn.hoofungson.studio.shiro.demo.entity.User;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description: 用户Dao
 * @Author 胡松 hoofungson@163.com
 * @Date 2017-12-19 14:25
 * @Version V1.0
 */
public interface IUserDao extends CrudRepository<User,Long> {

    @Transactional
    @Query("select u from User u where u.username =:username")
    User findByName(@Param("username") String username);

    @Query("select u from User u")
    List<User> getList();
}
